package com.andy.network.util

import com.blankj.utilcode.util.ToastUtils

/**
 * @creator:LuoFan
 * @date:2022/9/29
 * @description:
 */
abstract class HttpListenerImpl<T>(private val errorToast: Boolean = true) : HttpListener<T> {

    override fun onError(errorCode: Int, errorMsg: String) {
        if (errorToast) {
            ToastUtils.showShort(errorMsg)
        }
    }

    override fun onFailed(error: Throwable?) {
        if (errorToast) {
            ToastUtils.showShort(error?.message)
        }
    }

}